<?php

class Provider_model extends MY_Model {

    function __construct() {
        parent::__construct();
        $this->table = 'provider';
    }

    function get($sort = 'id', $order = 'asc') {
        $this->db->select('provider.*');
        $this->db->order_by('provider.' . $sort, $order);
        $this->db->order_by('provider.update_date', 'desc');
        $query = $this->db->get($this->table);
        return $query->result();
    }
    function getSearch($params, $sort = 'id', $order = 'asc') {
    	$this->db->select('provider.*');
    	if ($params['provider_name'] != '') {
    		$this->db->like('provider.provider_name', trim($params['provider_name']), 'both');
    	}
    	$this->db->order_by('provider.' . $sort, $order);
    	$this->db->order_by('provider.update_date', 'desc');
    	$query = $this->db->get($this->table);
    	return $query->result();
    }
   

}

?>